<?php include_once './header.php'; ?>
<? 
include('config.php'); 
if (isset($_GET['idTipoAlojamiento']) ) { 
$idTipoAlojamiento = (int) $_GET['idTipoAlojamiento']; 
if (isset($_POST['submitted'])) { 
foreach($_POST AS $key => $value) { $_POST[$key] = mysql_real_escape_string($value); } 
$sql = "UPDATE `tipoalojamiento` SET  `tipoAlojamiento` =  '{$_POST['tipoAlojamiento']}' ,  `descTipoAlojamiento` =  '{$_POST['descTipoAlojamiento']}' ,  `precio` =  '{$_POST['precio']}'   WHERE `idTipoAlojamiento` = '$idTipoAlojamiento' "; 
mysql_query($sql) or die(mysql_error()); 
echo (mysql_affected_rows()) ? "Edited row.<br />" : "Nothing changed. <br />"; 
echo "<a href='listTipoAloja.php'>Back To Listing</a>"; 
} 
$row = mysql_fetch_array ( mysql_query("SELECT * FROM `tipoalojamiento` WHERE `idTipoAlojamiento` = '$idTipoAlojamiento' ")); 
?>

<form action='' method='POST'> 
<p><b>TipoAlojamiento:</b><br /><input type='text' name='tipoAlojamiento' value='<?= stripslashes($row['tipoAlojamiento']) ?>' /> 
<p><b>DescTipoAlojamiento:</b><br /><input type='text' name='descTipoAlojamiento' value='<?= stripslashes($row['descTipoAlojamiento']) ?>' /> 
<p><b>Precio:</b><br /><input type='text' name='precio' value='<?= stripslashes($row['precio']) ?>' /> 
<p><input type='submit' value='Edit Row' /><input type='hidden' value='1' name='submitted' /> 
</form> 
<? } ?> 

<?php include_once './footer.php'; ?>